package cn.math.appmath.biz.impl;

import java.util.List;

import cn.math.appmath.bean.MemberBean;
import cn.math.appmath.biz.MemberBiz;
import cn.math.appmath.dao.MemberDao;
import cn.math.appmath.entity.Member;

public class MemberBizImpl implements MemberBiz {
	private MemberDao memberDao ;
	
	public boolean delete(Integer[] ids) {
		return this.memberDao.batchDelete(ids);
	}

	public MemberBean findAll(int page, String param) {
		if(param.equals("forward")){
			page = page - 2;
		}
		return this.memberDao.findAll(page);
	}

	public List<Member> findByField(String field) {
		try{
			return memberDao.findByProperty("mfields", field);
		}catch(RuntimeException re){
			re.printStackTrace();
			throw(re);
		}
	}

	public Member getById(Integer id) {
		return memberDao.findById(id);
	}

	public boolean save(Member member) {
		return memberDao.save(member);
	}

	public void update(Member member) {
		// TODO Auto-generated method stub

	}

	public void setMemberDao(MemberDao memberDao) {
		this.memberDao = memberDao;
	}

	public MemberDao getMemberDao() {
		return memberDao;
	}

}
